﻿package 
{
	import flash.display.MovieClip;
	
	public class Enemy extends MovieClip 
	{
		public var Name:String;
		
		public var Attack:int;
		public var Defense:int;
		public var MagicPwr:int;
		public var MagicDef:int;
		public var MaxHealth:int;
		public var MaxMagic:int;
		public var Accuracy:int;
		public var Evasion:int;
		public var Speed:int;
		public var Luck:int;
		
		private var _Health:int;
		public function set Health(value:int):void 
		{
			if (value > MaxHealth)
			{
				value = MaxHealth;
			}
			if (value < 0)
			{
				value = 0;
			}
			_Health = value;
		}
		public function get Health():int 
		{
			return _Health;
		}
		
		private var _Magic:int;
		public function set Magic(value:int):void 
		{
			if (value > MaxMagic)
			{
				value = MaxMagic;
			}
			if (value < 0)
			{
				value = 0;
			}
			_Magic = value;
		}
		public function get Magic():int 
		{
			return _Magic;
		}
		
		public function Enemy()
		{
			init();
		}
		
		private function init():void
		{
			Name = StringHelper.Empty;
			
			Attack = 0;
			Defense = 0;
			MagicPwr = 0;
			MagicDef = 0;
			MaxHealth = 0;
			MaxMagic = 0;
			Accuracy = 0;
			Evasion = 0;
			Speed = 0;
			Luck = 0;
			
			Health = 0;
			Magic = 0;
		}
		
		public function FullHeal():void
		{
			Health = MaxHealth;
			Magic = MaxMagic;
		}
	}
}